package com.zui.entity.product;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;

import com.zui.entity.BaseAssignedIdEntity;



@Entity
@Table(name="feature_category")
/**
 * TODO: 可以一次性批量添加features
 * @author Sam
 *
 */
public class FeatureCategory extends BaseAssignedIdEntity {
	private static final long serialVersionUID = 1L;
	
	public FeatureCategory() {}
	
	private String name;
	private String nameEn;
	private FeatureCategory parentFeatureCategory;
	private List<Feature> features;

	/*------------------------------
	 * getters and annotations
	 --------------------------------*/
	@Column(length=50)
	public String getName() {return name;}
	@Column(length=50)
	public String getNameEn() {
		return nameEn;
	}

	@ManyToOne
	@JoinColumn(name="parentFeatureCategoryId")
	public FeatureCategory getParentFeatureCategory() {return parentFeatureCategory;}

	@OneToMany(mappedBy = "featureCategory", fetch = FetchType.LAZY,cascade = {CascadeType.ALL})
	@OrderBy(value = "sequenceNum")
	public List<Feature> getFeatures() {
		return features;
	}
	
	
	
	public void setFeatures(List<Feature> features) {
		this.features = features;
	}
	public void setName(String name) {
		this.name = name;
	}

	public void setParentFeatureCategory(FeatureCategory parentFeatureCategory) {
		this.parentFeatureCategory = parentFeatureCategory;
	}
	public void setNameEn(String nameEn) {
		this.nameEn = nameEn;
	}

}
